home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Icon / c / StartDrag < prev    next >
Text File  |  1995-07-08  |  2KB  |  55 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Icon.StartDrag.c
  12.     Author:  Copyright © 1992 Jason Williams
  13.     Version: 1.00 (31 Mar 1992)
  14.     Purpose: Starts the drag operation of any icon (i.e. file icon)
  15. */
  16.  
  17.  
  18. #include "DeskLib:Wimp.h"
  19. #include "DeskLib:WimpSWIS.h"
  20. #include "DeskLib:Screen.h"
  21. #include "DeskLib:Icon.h"
  22.  
  23.  
  24. /*  Note: Use Icon_StartSolidDrag() or DragASprite_DragIcon() to start
  25.  *  dragging an icon with DragASprite
  26.  */
  27.  
  28. extern void Icon_StartDrag(window_handle window, icon_handle icon)
  29. {
  30.   icon_block   istate;
  31.   window_state wstate;
  32.   drag_block   drag;
  33.   int          left, top;
  34.  
  35.   Wimp_GetWindowState(window, &wstate);
  36.   Wimp_GetIconState(window, icon, &istate);
  37.   left = wstate.openblock.screenrect.min.x - wstate.openblock.scroll.x;
  38.   top  = wstate.openblock.screenrect.max.y - wstate.openblock.scroll.y;
  39.  
  40.   drag.window = window;
  41.   drag.type   = drag_FIXEDBOX;
  42.  
  43.   drag.screenrect.min.x = left + istate.workarearect.min.x;
  44.   drag.screenrect.max.x = left + istate.workarearect.max.x;
  45.   drag.screenrect.min.y = top  + istate.workarearect.min.y;
  46.   drag.screenrect.max.y = top  + istate.workarearect.max.y;
  47.  
  48.   Screen_CacheModeInfo();
  49.   drag.parent.min.x = 0;
  50.   drag.parent.min.y = 0;
  51.   drag.parent.max   = screen_size;
  52.  
  53.   Wimp_DragBox(&drag);
  54. }
  55.